#include <iostream>
#include <cstring>
using namespace std;

#define MAX_N 10000
#define MAX_EXPENSE 5000
int expense[MAX_N + 5];
int dp[MAX_EXPENSE + 5];

int main()
{
    int n, total;
    cin >> n >> total;
    if(total == 0)
    {
        cout << 0;
        return 0;
    }
    int min_expense = 0x3f3f3f3f;
    for(int i = 0; i < n; i++) 
    {
        cin >> expense[i];
        min_expense = min(min_expense, expense[i]);
    }
    if(min_expense > total)
    {
        cout << -1;
        return 0;
    }
    memset(dp, 0x3f3f3f3f, sizeof dp);
    dp[0] = 0;
    int ret = 0x3f3f3f3f;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j <= total; j++)
        {
            if(j < expense[i]) continue;
            dp[j] = min(dp[j - expense[i]] + 1, dp[j]);
        }
    }
    cout << (dp[total] == 0x3f3f3f3f ? -1 : dp[total]);
    return 0;
}